<template>
	<view class="box" :style="{'padding-top':systemHeight+28.5+'px'}">
		<view class="head">
			<image class="back" src="/static/img/back.png" @click="back()"></image>
			<view class="title">Discounts</view>
			<view class="right"></view>
		</view>
		<view class="selects">
			<view class="select" v-for="(item,index) in selects" :key="index" :class="{selec:item.id==disType}"
				@click="disType=item.id">{{item.title}}
				<view class="select_on" v-if="item.id==disType"></view>
				<view class="select_no" v-else></view>
			</view>

		</view>
		<view class="discount" :class="{undiscount:disType!='1'}">
			<view class="oruse" v-if="disType==1">use</view>
			<view class="oruse" v-if="disType==2">used</view>
			<view class="oruse" v-if="disType==3">Expired</view>
			<view class="dis_box">
				<view class="dis_box_left" :class="{un_text:disType!='1'}"><text>MK</text>1000<text></text></view>
				<view class="line"></view>
				<view class="dis_box_right">
					<view class="name">Car coupons</view>
					<view class="money" v-if="disType==1">Available over Mk4000</view>
					<view class="time">Valid until 2025-06-31</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				systemHeight: null,
				disType: 1,
				selects: [{
					id: 1,
					title: 'Be usable'
				}, {
					id: 2,
					title: 'Has been used'
				}, {
					id: 3,
					title: 'Expired'
				}]
			}
		},
		created() {
			this.systemHeight = uni.getSystemInfoSync().statusBarHeight
		},
		methods: {
			back() {
				uni.navigateBack()
			}
		}
	}
</script>

<style>
	.box {
		display: flex;
		flex-direction: column;
		align-items: center;
		position: fixed;
		width: 100%;
		height: 100vh;
	}

	.head {
		width: 92%;
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin-bottom: 57rpx;
	}

	.back {
		width: 20rpx;
		height: 36rpx;
	}

	.title {
		font-family: Mont;
		font-weight: bold;
		font-size: 32rpx;
	}

	.right {
		width: 20rpx;
	}

	.selects {
		width: 85%;
		display: flex;
		justify-content: space-between;
		align-items: center;
		font-family: Mont;
		font-weight: 500;
		font-size: 28rpx;
		margin-bottom: 33rpx;
	}

	.select {
		display: flex;
		flex-direction: column;
		align-items: center;
	}

	.selec {
		color: #33BA78;
		border-bottom: ;
	}

	.select_on {
		margin-top: 10rpx;
		width: 46rpx;
		height: 8rpx;
		background: #33BA78;
		border-radius: 4rpx;
	}

	.select_no {
		margin-top: 10rpx;
		width: 46rpx;
		height: 8rpx;
	}

	.discount {
		position: relative;
		width: 94%;
		height: 213rpx;
		background: #33BA78;
		box-shadow: 0rpx 10rpx 50rpx 0rpx rgba(77, 97, 141, 0.08);
		border-radius: 30rpx;
	}

	.undiscount {
		color: #454545;
		background: #454545;
	}

	.oruse {
		position: absolute;
		top: 50%;
		right: 27rpx;
		transform: translate(0, -50%);
		font-family: Mont;
		font-weight: bold;
		font-size: 24rpx;
		color: #FFFFFF;
	}

	.dis_box {
		position: absolute;
		top: 0;
		left: 0;
		width: 570rpx;
		height: 214rpx;
		background: #FFFFFF;
		box-shadow: -10rpx -1rpx 50rpx 0rpx rgba(55, 55, 55, 0.08);
		border-radius: 30rpx;
		display: flex;
		align-items: center;
		padding-left: 22rpx;
	}

	.dis_box_left {
		font-family: Mont;
		font-weight: bold;
		font-size: 70rpx;
		color: #33B777;
		margin-right: 26rpx;
	}

	.dis_box_left text {
		font-size: 30rpx;
	}

	.un_text {
		color: #454545;
	}

	.line {
		margin-right: 23rpx;
		width: 1rpx;
		height: 164rpx;
		border-left: 1px dashed #7D7D7D;
		opacity: 0.7;
	}

	.name {
		width: 262rpx;
		font-family: Mont;
		font-weight: bold;
		font-size: 36rpx;
		white-space: pre-wrap;
		word-wrap: break-word;
		margin-bottom: 30rpx;
	}

	.money {
		font-family: Mont;
		font-weight: 500;
		font-size: 20rpx;
		white-space: pre-wrap;
		word-wrap: break-word;
		margin-bottom: 40rpx;
	}

	.time {
		font-family: Mont;
		font-weight: 500;
		font-size: 20rpx;
		color: #050A10;
		line-height: 37rpx;
		opacity: 0.5;
	}
</style>